#ifndef COMMON_H
#define COMMON_H

class eventHandle;

const int RNLC_SUCC = 0;
const int RNLC_FAIL = 1;
#ifndef NULL
#define NULL  0
#endif

typedef void (eventHandle::*func)();

struct eventTab
{
    int event;
    func fun;
};

typedef struct tMessage
{
    int event;
    char* ptmsg;
}Message;

typedef struct tmsgNodes
{
    Message p_curmsg;
    tmsgNodes *next;
  
    
}msgNodes;
/////////////////////MAYBE////////////////////////////
template <typename T>
struct Maybe
{
public:
	Maybe() : present(false) {}

	Maybe(const T& object)
		: present(true)
	{
		this->object = object;
	}
	T* operator= (T *rhs)
	{
		*object = rhs;
		return *object;
	}
	T& getref()
	{
		return object;
	}
	~Maybe()
	{
		object.destory();
	}
	private:
		bool present;
		T object;

};
/////////////////////Placement////////////////////////////
template <typename T>
struct Placement
{
	T *alloc()
	{
		return (void*)u.buff;
	}
	Placement& operator=(const T& rhs)
    {
        T *p =(T*)alloc()
        *p = rhs;
        return *this;
    }

private:
	union
	{
		char   c;
		short  s;
		int    i;
		long   l;
		float  f;
		double d;
		void*  p;
		char buff[sizeof(T)];
	}u;
};



#endif
